import request from "@/request";
export function noticeListRequest(pageNum: number = 1, pageSize: number = 10) {
  return request({
    url: '/admin/notice/list',
    method: 'get',
    params: {
      pageNum,
      pageSize
    }
  })
}
export function noticeDelRequest(id: string) {
  return request({
    url: '/admin/notice/delete/' + id,
    method: 'delete',

  })
}
export function noticeAddRequest(title: string, content: string, categoryId: string) {
  return request({
    url: '/admin/notice/create',
    method: 'post',
    data: {
      title,
      content,
      categoryId
    }

  })
}
export function noticeUpdataRequest(id: string, title: string, content: string, categoryId: string) {
  return request({
    url: '/admin/notice/update/' + id,
    method: 'put',
    data: {
      id,
      title,
      content,
      categoryId
    }

  })
}
export function noticeCategoryRequest(pageNum: number = 1, pageSize: number = 10) {
  return request({
    url: '/admin/notice-category/list',
    method: 'get',
    params: {
      pageNum,
      pageSize
    }
  })
}

export function noticeUpdateRequest(id: string, title: string, content: string, categoryId: string) {
  return request({
    url: '/admin/notice/update/' + id,
    method: 'put',
    data: {
      title,
      content,
      categoryId
    }
  })
}
export function CategoryListRequest() {
  return request({
    url: '/admin/notice-category/list',
    method: 'get',
  })
}

export function noticeCategoryAddRequest(name: string) {
  return request({
    url: '/admin/notice-category/create',
    method: 'post',
    data: {
      name
    }
  })
}

export function noticeCategoryDelRequest(id: string) {
  return request({
    url: '/admin/notice-category/delete/' + id,
    method: 'delete'
  })
}

export function noticeCategoryUpdateRequest(id: string, name: string) {
  return request({
    url: '/admin/notice-category/update/' + id,
    method: 'put',
    data: {
      id,
      name
    }
  })
}
